@extends('layouts.default')
@if(\Illuminate\Support\Facades\Auth::check())
  @section('styles')
    <link rel="stylesheet" type="text/css" href="{{ asset('css/simditor.css') }}">
  @stop
@endif
@section('content')
  @if(\Illuminate\Support\Facades\Auth::check())
    <div class="row">
      <div class="col-md-8">
        <section class="status_form">
          @include('shared._status_form')
        </section>
        <h4>列表</h4>
        <hr>
        @include('shared._feed')
      </div>
      <aside class="col-md-4">
        <section class="user_info">
          @include('shared._user_info', ['user' => \Illuminate\Support\Facades\Auth::user()])
        </section>
        <section class="stats mt-2">
          @include('shared._stats', ['user' => \Illuminate\Support\Facades\Auth::user()])
        </section>
      </aside>
    </div>
  @else
    <div class="jumbotron">
      <h1>Hello Laravel</h1>
      <p class="lead">
        {{ env('APP_NAME') }}
      </p>
      <p>
        一切，将从这里开始。
      </p>
      <p>
        <a class="btn btn-lg btn-success" href="{{ route('signup') }}" role="button">现在注册</a>
      </p>
    </div>
  @endif
@stop
@if(\Illuminate\Support\Facades\Auth::check())
  @section('scripts')
    <script type="text/javascript" src="{{ asset('js/module.js') }}"></script>
    <script type="text/javascript" src="{{ asset('js/hotkeys.js') }}"></script>
    <script type="text/javascript" src="{{ asset('js/uploader.js') }}"></script>
    <script type="text/javascript" src="{{ asset('js/simditor.js') }}"></script>

    <script>
      $(document).ready(function() {
        var editor = new Simditor({
          textarea: $('#editor'),
          upload: {
            url: '{{ route('upload_image') }}',
            params: {
              _token: '{{ csrf_token() }}'
            },
            fileKey: 'upload_file',
            connectionCount: 3,
            leaveConfirm: '文件上传中，关闭此页面将取消上传。'
          },
          pasteImage: true,
        });
      });
    </script>
  @stop
@endif
